
var MyQueue = function () {
    this.inList = [];
    this.outList = []
};

/** 
 * @param {number} x
 * @return {void}
 */
MyQueue.prototype.push = function (x) {
    this.inList.push(x)
};

/**
 * @return {number}
 */
MyQueue.prototype.pop = function () {
    if (this.outList.length === 0) {
        transList(this.inList, this.outList)
    }
    return this.outList.pop()
};

/**
 * @return {number}
 */
MyQueue.prototype.peek = function () {
    if (this.outList.length === 0) {
        transList(this.inList, this.outList)
    }
    return this.outList[this.outList.length - 1]
};

function transList(inList, outList) {
    while (inList.length > 0) {
        outList.push(inList.pop())
    }
}

/**
 * @return {boolean}
 */
MyQueue.prototype.empty = function () {
    return this.inList.length === 0 && this.outList.length === 0
};

var obj = new MyQueue()
obj.push(123)
obj.push(234)
var param_2 = obj.pop()
var param_3 = obj.peek()
var param_4 = obj.empty()
console.log(param_2, param_3, param_4)